#include<iostream>
#include<cmath>
using namespace std;
int n,m,k,m1;
int main()
{
    while (cin>>n>>m)
    {
        if(n>m){k=n-m;}
        else{k=m-n;m=n;}
        
        m1=(int)k*(1+sqrt(5.0))/2;
        puts(m1==m?"0":"1");
    }
    return 0;
}
